package com.larry.spark.rdd.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object RDD_Oper_Glom {

  def main(args: Array[String]): Unit = {
    //TODO  使用spark

    val conf = new SparkConf().setMaster("local[*]").setAppName("rdd")
    val sc = new SparkContext(conf)

    val rdd : RDD[Int] = sc.makeRDD(List(1,2,3,4,5,6),2)

    //扁平化  模式匹配
    val rdd1 : RDD[Array[Int]] = rdd.glom()

    rdd1.collect().foreach(a => println(a.mkString(",")))

    sc.stop()
  }
}
